import {GETROUTERS, GETROUTERSSUCCESS, GETUSERINFO, GETUSERINFOSUCCESS} from "@/stores/actionTypes/userInfoActionType";
import {IUserInfoState} from "@/stores/reducers/userInfoReducers";

export interface IGetUserInfoAction {
    type: typeof GETUSERINFO
}

export const getUserInfoAction = (): IGetUserInfoAction => ({
    type: GETUSERINFO
})

export interface IGetUserInfoSuccessAction {
    type: typeof GETUSERINFOSUCCESS
    payload: IUserInfoState
}

export const getUserInfoSuccessAction = (payload: IUserInfoState): IGetUserInfoSuccessAction => ({
    type: GETUSERINFOSUCCESS,
    payload
})

export interface IGetRoutersAction {
    type: typeof GETROUTERS
}

export const getRoutersAction = (): IGetRoutersAction => ({
    type: GETROUTERS
})

export interface IGetRoutersSuccessAction {
    type: typeof GETROUTERSSUCCESS
    payload: Array<any>
}

export const getRoutersSuccessAction = (payload: any[]): IGetRoutersSuccessAction => ({
    type: GETROUTERSSUCCESS,
    payload
})

export type UserInfoAction =
    IGetUserInfoAction
    | IGetUserInfoSuccessAction
    | IGetRoutersAction
    | IGetRoutersSuccessAction